package com.msb;

/**
 * @author lidexin
 * @create 2021-09-19 13:10
 */
public class T04_ThreadState {
    static class NyThread extends Thread {
        @Override
        public void run() {
            System.out.println(this.getState());

            for (int i =0;i < 10; i++) {
                try {
                    Thread.sleep(500);
                }catch (InterruptedException e) {
                    e.printStackTrace();
                }
                System.out.println(i);
            }
        }
    }

    public static void main(String[] args) {
        Thread t = new NyThread();

        System.out.println(t.getState());
        t.start();
        try {
            t.join();
        }catch (InterruptedException e) {
            e.printStackTrace();
        }
        System.out.println(t.getState());
    }
}
